package com.fox.presentation.controller;

import com.fox.application.dto.CreateOrderCommand;
import com.fox.application.service.OrderApplicationService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.UUID;

/**
 * 表现层：接收 HTTP 请求，调用应用服务
 */
@RestController
@RequestMapping("/api/orders")
public class OrderController {

    private final OrderApplicationService orderService;

    public OrderController(OrderApplicationService orderService) {
        this.orderService = orderService;
    }

    @PostMapping
    public ResponseEntity<String> createOrder(@RequestBody CreateOrderCommand cmd) {
        UUID orderId = orderService.createOrder(cmd);
        return ResponseEntity.ok(orderId.toString());
    }
}